package com.example.web.server.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.stereotype.Service;

import com.example.web.server.EmailService;
import com.example.web.server.SendEmail;

@Service("EmailServiceImpl")
public class EmailServiceImpl implements EmailService{

	HashMap<String, SendEmail> serviceHashMap = new HashMap<String, SendEmail>();
	
	public EmailServiceImpl(List<SendEmail> sendEmails){
		for (SendEmail sendEmail : sendEmails) {
			serviceHashMap.put(sendEmail.type(),sendEmail);
		}
	}
	/**
	 * subject标题
	 */
	@Override
	public String Send(String subject, String to) {
		return serviceHashMap.get(subject).spellTempalte(to);
	}

}
